import request from '../../../utils/request'

//查询出所有组织机构接口
export const ListAllSysCompany = () => {
    return request({
        url: `/syscompany/listAllSysCompany`,
        method: 'get',
    })
}

//新增根组织机构接口 
export const AddRootSysCompany = (syscompany) => {
    return request({
        url: `/syscompany/addRootSysCompany`,
        method: 'post',
        data: syscompany,
    })
}

//新增叶子节点组织机构接口
export const AddLeafSysCompany = (leafSysCompanyCode, syscompany) => {
    return request({
        url: `/syscompany/addLeafSysCompany/${leafSysCompanyCode}`,
        method: 'post',
        data: syscompany,
    })
}

//编辑组织机构接口
export const EditSysCompany = (syscompany) => {
    return request({
        url: `/syscompany/editSysCompany`,
        method: 'put',
        data: syscompany,
    })
}

//删除根组织机构接口
export const DeleteRootSysCompany = (companyCode) => {
    return request({
        url: `/syscompany/deleteRootSysCompany/${companyCode}`,
        method: 'delete',
    })
}

//删除叶子组织结构接口
export const DeleteLeafSysCompany = (companyCode) => {
    return request({
        url: `/syscompany/deleteLeafSysCompany/${companyCode}`,
        method: 'delete',
    })
}

//查询某个组织结构接口
export const ListAllSysCompanyByCondition = (keyWord) => {
    return request({
        url: `/syscompany/listAllSysCompany/${keyWord}`,
        method: 'get',
    })
}